home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Hacks / Hacks ’95 / ProcessBar™ / Code / Sources / mdg.h < prev    next >
Encoding:
Text File  |  1995-06-24  |  3.5 KB  |  121 lines  |  [TEXT/MMCC]

  1. ////////////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Portions copyright © 1995 Mark D. Gerl.  All rights reserved worldwide.
  4. //
  5. // Project:        ProcessBar™
  6. //
  7. // File:        mdg.h
  8. //
  9. // Description:    Most of the code written to extend Matt Slot's appe Windows into what it is
  10. //
  11. // Written by:    Mark D. Gerl
  12. //
  13. // Disclaimer:    Written over 40 hours at MacHack '95 -- use at your own risk (actually, I think
  14. //                this code is REALLY stable)!
  15. //
  16. ////////////////////////////////////////////////////////////////////////////////////////////////////
  17.  
  18.  
  19. #if !defined(__MDG__)
  20. #define __MDG__
  21.  
  22.  
  23. #include <Types.h>
  24. #include <Files.h>
  25. #include <Processes.h>
  26. #include <AppleEvents.h>
  27.  
  28. #define kStandardIconSize            32
  29. #define kTaskbarButtonFrameWidth    2
  30. #define kTaskbarButtonBorderSize    4
  31. #define kTaskbarTopMargin            4
  32. #define kTaskbarLeftMargin            6
  33. #define kTaskbarBetweenMargin        6
  34. #define kTaskbarScreenBottomMargin    4
  35. #define kTaskbarHeight                (kStandardIconSize + (kTaskbarTopMargin << 1))
  36.  
  37. #define kMaxProcesses                25
  38.  
  39. #define kTaskbarFont                applFont
  40. #define kTaskbarFontSize            12
  41. #define kTaskbarFontStyle            bold
  42.  
  43. #define kTaskbarBgColor                0xbbbb
  44. #define kLtGrayColorValue            0xeeee
  45. #define kDkGrayColorValue            0x8000
  46.  
  47. #define kMacOSIconRsrcID            130
  48.  
  49. typedef enum
  50. {
  51.     kFrameInset,
  52.     kFrameOutset
  53. } FrameType;
  54.  
  55. typedef struct
  56. {
  57.     ProcessSerialNumber                psn;
  58.     Rect                            buttonRect;
  59.     Handle                            iconSuite;
  60.     Boolean                            iconIsHilited;
  61.     
  62. } PSNRec, *PSNRecPtr, **PSNRecHdl;
  63.  
  64. extern const RGBColor                kBgGrayColor;
  65. extern const RGBColor                kLtGrayColor;
  66. extern const RGBColor                kDkGrayColor;
  67.  
  68. extern WindowPtr                    gTaskbarWindow;
  69. extern Boolean                        gTaskbarVisible;
  70.  
  71. // Prototypes of code written by Mark D. Gerl
  72.  
  73. void    SetupOffscreenWorld(void);
  74. void    UpdateFromOffscreenWorld(Rect *r);
  75.  
  76. void    Draw3DFrame(Rect * r, FrameType ft);
  77. void    ShowTaskbar(WindowPtr win);
  78. void    HideTaskbar(WindowPtr win);
  79. void    ToggleTaskbarVisibility(WindowPtr win);
  80. Boolean    FindFirstVisibleProcess(ProcessSerialNumber *psn);
  81. void    TogglePSNVisibility(ProcessSerialNumber *psn);
  82. void    BringPSNToFront(ProcessSerialNumber *psn);
  83. void    Remove1TaskbarProcess(short processArrayIndex);
  84. void    RemovePSNFromProcessArray(ProcessSerialNumber *psn);
  85. Boolean    FindPSNInProcessArray(ProcessSerialNumber *psn, short *processArrayIndex);
  86. Boolean    FindPSNForClick(Point where, ProcessSerialNumber *psn, short *processArrayIndex);
  87. Boolean    IsProcessAlive(ProcessSerialNumber *psn);
  88. void    UpdateProcessArray(void);
  89. void    AdjustIcons(void);
  90. void    HiliteCurrentProcess(void);
  91. void    IdleTaskbar(void);
  92. void    DoMacOSIconClick(EventRecord *theEvent);
  93. Boolean TrackTaskbarButtonClick(EventRecord *theEvent, Rect *box);
  94. void    DoClickInTaskbar(EventRecord *theEvent, WindowPtr win);
  95. void    AddProcessToTaskbar(ProcessSerialNumber *psn);
  96. void    DrawMacOSIcon();
  97. void    Draw1TaskbarProcess(short processArrayIndex);
  98. void    DrawTaskbar(WindowPtr win);
  99.  
  100. // The following code was nabbed from MacApp
  101.  
  102. void    PullApplicationToFront();
  103. static    Boolean IsThisKeyDown(const short theKey);
  104. Boolean IsCommandKeyDown();
  105. Boolean IsControlKeyDown();
  106. Boolean IsOptionKeyDown();
  107. Boolean IsShiftKeyDown();
  108.  
  109. // Borrowed from DropShell 2.0 sources (thanks Leonard!)...
  110.  
  111. void    GetMyAppName(Str255 appName);
  112. void    GetAppFSSpec(FSSpec *appSpec);
  113. OSErr    GetTargetFromSelf (AEAddressDesc *targetDesc);
  114. OSErr    GetTargetFromSignature (OSType processSig, AEAddressDesc *targetDesc);
  115. void    SendQuitToSelf (void);
  116. void    SendQuitToPSN (ProcessSerialNumber *psn);    // based on SendQuitToSelf()
  117. void    SendRestartToFinder();
  118. void    SendShutDownToFinder();
  119.  
  120.  
  121. #endif